added some development tools
[windows-sources.git] / developer / Samples / NET 4.6 / Samples for Parallel / Sudoku / Sudoku_CSharp / Controls / ImagePanel.cs
blob17fb8863636f6c8d4318bca164893e9a5f5c8ae7
1 //--------------------------------------------------------------------------
2 //
3 // Copyright (c) Microsoft Corporation. All rights reserved.
4 //
5 // File: ImagePanel.cs
6 //
7 // Description: A panel used to render a double-buffered image.
8 //
9 //--------------------------------------------------------------------------
11 using System.ComponentModel;
12 using System.Drawing;
13 using System.Windows.Forms;
15 namespace Microsoft.ParallelComputingPlatform.ParallelExtensions.Samples.Sudoku.Controls
17 /// <summary>Double-buffered panel that displays a stretched image.</summary>
18 internal class ImagePanel : NoFlickerPanel
20 /// <summary>Initializes the panel.</summary>
21 public ImagePanel(){}
23 /// <summary>The image to be rendered.</summary>
24 private Image _img;
26 /// <summary>Gets or sets the image to be rendered.</summary>
27 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
28 [Browsable(false)]
29 public Image Image { get { return _img; } set { _img = value; } }
31 /// <summary>Paints the image.</summary>
32 /// <param name="e">Paint event args.</param>
33 protected override void OnPaint(PaintEventArgs e)
35 if (_img != null)
37 e.Graphics.DrawImage(_img, 0, 0, Width, Height);
39 base.OnPaint(e);